;; 测试wireguardquick服务


(use-modules
 (gnu)
 (gnu packages)
 (gnu packages bash)
 (gnu packages linux)
 (gnu packages shells)
 (gnu services base)
 (gnu services networking)
 (gnu services sysctl)
 (luhux services vpn)
 )



(operating-system
 (host-name "wireguardquick")
 (timezone "Hongkong")
 (locale "en_US.utf8")

 ;; 引导
 (bootloader (bootloader-configuration
	      (bootloader grub-bootloader)
	      (target "/dev/sda")))
 
 ;; 文件系统
 (file-systems (append (list (file-system
			      (device "/dev/vda1")
			      (mount-point "/")
			      (type "ext4")
			      ) 
			     )
		       %base-file-systems))

 ;; 全局安装的包
 (packages
  (map
   specification->package
   (list
    ;; shell
    "bash"

    ;; 工具集
    "busybox"

    ;; Linux 模块
    "kmod"

    ;; udev
    "eudev"
    
    ;; 用户管理
    "shadow"

    ;; 终端复用器
    "tmux"

    ;; ssl证书
    "nss-certs"

    ;; Wireguard VPN
    "wireguard-tools"
    )
   )
  )

 ;; 服务
 (services
  (list
   ;; 脚本兼容
   (service special-files-service-type
	    `(("/bin/sh" ,(file-append bash "/bin/sh"))
	      ("/usr/bin/env" ,(file-append coreutils "/bin/env"))))

   ;; tty 登录
   (service login-service-type)
   (service virtual-terminal-service-type)
   (service agetty-service-type (agetty-configuration
				 (extra-options '("-L"))
				 (term "vt100")
				 (tty #f)))
   (service mingetty-service-type (mingetty-configuration
				   (tty "tty1")))
   (service mingetty-service-type (mingetty-configuration
				   (tty "tty2")))
   (service mingetty-service-type (mingetty-configuration
				   (tty "tty3")))
   (service mingetty-service-type (mingetty-configuration
				   (tty "tty4")))
   (service mingetty-service-type (mingetty-configuration
				   (tty "tty5")))
   (service mingetty-service-type (mingetty-configuration
				   (tty "tty6")))
   
   ;; 随机数设备
   (service urandom-seed-service-type)

   ;; nscd 服务
   (service nscd-service-type)

   ;; udev
   (service udev-service-type)

   ;; log 记录服务
   (syslog-service)


   ;; 网络
   (service static-networking-service-type
	    (list (static-networking (interface "lo")
				     (ip "127.0.0.1")
				     (requirement '())
				     (provision '(loopback)))))
   (service dhcp-client-service-type)


   ;; Wireguard quick
   (service wireguard-quick-service-type
	    (wireguard-quick-configuration
	     (interface "wg0")))
   (service wireguard-quick-service-type
	    (wireguard-quick-configuration
	     (interface "wg1")))
   (service wireguard-quick-service-type
	    (wireguard-quick-configuration
	     (interface "wg2")))
   )
  )
 )


